package user;

import java.util.List;

import dao.Palydao;
import dao.Palydaoimpl;
import entity.ChallengeInfo;

public class TabAction {
	//inoutput
	//页大小
	private int pagesize = 15;
	//页数
	private int pagenum = 1;
	//最大页数
	private int maxPage = 1;
	//总记录数
	private int totalnum = 0;
	
	//output
	private List<ChallengeInfo> tab;

	public String execute() throws Exception {

		Palydao dao = new Palydaoimpl();
		
		tab = dao.find(0,pagesize,pagenum);
		totalnum = dao.findAll(0);
		maxPage = totalnum/pagesize + 1;
		
		return "success";
	}

	public List<ChallengeInfo> getTab() {
		return tab;
	}

	public void setTab(List<ChallengeInfo> tab) {
		this.tab = tab;
	}

	
	public int getPagesize() {
		return pagesize;
	}

	public void setPagesize(int pagesize) {
		this.pagesize = pagesize;
	}

	public int getPagenum() {
		return pagenum;
	}

	public void setPagenum(int pagenum) {
		this.pagenum = pagenum;
	}

	public int getMaxPage() {
		return maxPage;
	}

	public void setMaxPage(int maxPage) {
		this.maxPage = maxPage;
	}

	public int getTotalnum() {
		return totalnum;
	}

	public void setTotalnum(int totalnum) {
		this.totalnum = totalnum;
	}
	
}
